package chap04;

/**
 * 抽象类
 */
abstract class Student{
    int id;
    String name;
    abstract void setId(int id);
        public void study(){
        System.out.println("我的天职是学习");
    }
}
// 1.抽象类可以直接继承抽象类
abstract class SmallStudent extends Student{}

public class demon3 {
    public static void main(String[] args) {
        Student stu1 = new Student() {
            @Override
            void setId(int id) {

            }
        };
        stu1.id =1;
        stu1.name = "小明";
        stu1.study();
    }
}
